home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tpgrwndw.zip / WINDOWS.DOC < prev    next >
Text File  |  1993-01-04  |  6KB  |  155 lines

  1.                       Windows Version 1.00
  2.  
  3.  
  4.  
  5.                        By Todd Fiala
  6.  
  7.  
  8.                        Introduction
  9.  
  10.       This set of utilities is for use with Turbo Pascal 5.5.  You must be
  11. running Borland's Graphics System (use InitGraph).  This public domain package
  12. gives you a wide variety of subroutines for use in YOUR programs.  These window
  13. commands are for use in a graphics enviroment.  The only thing not provided is
  14. the actual implementation section for the unit.
  15.  
  16.                    Files contained :
  17.  
  18.                        Windows.doc : This documentary
  19.                        Windows.pas : The Interface section for Windows.tpu
  20.                        Windows.tpu : The Turbo Pascal 5.5 Unit file
  21.  
  22.  
  23.  
  24.                          Using Windows
  25.      To use windows.tpu in your programs, you must first set up the
  26. Borland Graphics system, using a code segment something like this:
  27.  
  28. uses Windows, Graph;
  29. var
  30.    grDriver,
  31.    grMode   : word;
  32.  
  33. begin
  34.   grDriver := Detect;
  35.   InitGraph(grDriver,grMode,'');
  36.   .
  37.   .
  38.   .
  39. end.
  40.  
  41.       For best results, use mode
  42.              VGA     VgaMed
  43.              MCGA    McgaHi
  44.              EGA     EgaHi
  45.              CGA     CgaHi
  46.  
  47.       To set the graphics mode, use
  48.               SetGraphMode(Mode);
  49.  
  50.  
  51.  
  52.  
  53.               Command Summary
  54.  
  55.       This section will explain the use and purpose of each part ofwindows.tpu.
  56.  
  57.                       GLOBAL VARIABLES
  58.  
  59. ShowBor : (Boolean)  When drawing any graphics window, if ShowBor is true,
  60.           a border will be drawn around the window. Disable border by typing
  61.           "ShowBor = false"
  62.  
  63. HitKey : (Boolean) This variable controls whether the window will be closed
  64.          after a key is hit or not.  This works with OpenWndw and ShowWndw.
  65.          It is reset to false after all window calls.  When true, the window
  66.          will automatically be closed after the next key is pressed.
  67.  
  68. TextCol : (word) This will be the color of the printed text on your graphics
  69.           windows.  Initially set to 0 (Black text on white background)
  70.  
  71. BackCol : (word) This will be the main window color, the background color for
  72.           the text.  Therefore you do not want to set BackCol = TextCol.
  73.  
  74. BorCol : (word) If ShowBor is True, then a border will be drawn around all
  75.          graphics windows of color BorCol.
  76.  
  77.  
  78.                PROCEDURES AND FUNCTIONS
  79.  
  80.       In Windows.pas, a pretty good explanation for all of these functions and
  81. procedures are given.  This is just to clear up any misconceptions.
  82.  
  83. procedure ClearText
  84.      This will clear the internal window text buffer.  Will not need to be
  85. called unless you specifically want to wipe out what's in the buffer.
  86. (cleared after windows are closed)
  87.  
  88. procedure WriteWndw(AddStr : string)
  89.      WriteWndw will add the text AddStr to the window text buffer.  When a
  90. graphics text window is open (with ShowWndw,CursorWndw, or OpenWndw), the text
  91. in the window text buffer will be printed in the window.
  92.  
  93. procedure SetBuf
  94.      This will set the buffer reader to start reading from the beginning of the
  95. buffer.
  96.  
  97. function ReadBuf(var ch : char) : boolean
  98.      Readbuf returns false if the buffer has been read to the end.  Ch is the
  99. next character it reads from the buffer.
  100.  
  101. function BufEmpty : boolean
  102.      This returns true if the buffer is indeed empty.
  103.  
  104. procedure GraphWndw(x1,y1,x2,y2 : word)
  105.      A window will be opened (close with CloseWndw).  The area behind this
  106. window will be saved.  The window is defined by (x1,y1) upper left, (x2,y2)
  107. lower right.  A border will be drawn if ShowBor is True.
  108.  
  109. function GrPos(TextPos : word) : word
  110.      GrPos returns the text mode equivelant graphics starting position.  For
  111. example, since the standard character is 8 pixels wide, if you say GrPos(2), it
  112. will return 8, because (2-1)*8 = 8.  Remember, text mode positions start at
  113. (1,1) while graphics mode coordinates start at (0,0), hence the (2-1)*8
  114. instead of 2*8.
  115.  
  116. procedure FormatBuffer
  117.      You dont really need to worry about this.  It is used to format the
  118. Window Text Buffer for word wrap and is used by WriteText.
  119.  
  120. procedure WriteText(x1,y,x2 : word)
  121.      This procedure will write the text in the text buffer between (and
  122. including) margins x1 and x2, starting at y. (All are Text Coordinates)
  123.  
  124. procedure OpenWndw(AddString : string; x1,y1,x2,y2 : word)
  125.      OpenWndw will open a window from text coordinates (x1,y1) {upper left}
  126. to (x2,y2) {lower right}.  It will add AddString to the Window Text Buffer and
  127. then write all text to the window after opened.  If HitKey is true, the window
  128. will disappear as soon an a key is hit [useful for information windows].  If
  129. HitKey is false, the window will remain open till closed with CloseWndw.
  130.  
  131. procedure ShowWndw(text : string)
  132.      This is the procedure to use if you don't want to worry about anything and
  133. just print a nice looking window.  It does all the work for you.  It opens a
  134. window as large as needed, centers it on the screen, and uses a nice word wrap.
  135. Uses Hitkey as above.
  136.  
  137. function CursorWndw(AddString : string) : string
  138.      Quite a handy function, it will add the text AddString to the window Text
  139. Buffer and open a window with a prompt line where it prints what you type.  It
  140. will return the string you type, and if Escape is pressed, will return a null
  141. string('').
  142.  
  143. procedure CloseWndw
  144.      This procedure will close the last open window.  If no window is open,
  145. then nothing will happen.
  146.  
  147. procedure ClearAllWndws
  148.      A mop up utility, it will close all the open windows and clear the text
  149. buffer.  Should use to initialize the system.
  150.  
  151.  
  152.               ADDITIONAL NOTES
  153.      If you run a microsoft compatable mouse in your programs, you should
  154. disable any mouse interrupts while calling window procedures, or errors WILL
  155. occur.